import React,{useState} from 'react';
import {Menu} from 'antd';
import {CameraOutlined,UserOutlined} from '@ant-design/icons';
import {withRouter} from 'react-router-dom';

const Sider =(props)=>{

    
    const [current,setCurrent]=useState("album")
 
    const handleClick=(e)=>{
        setCurrent(e.key);
        props.history.push(`/index/${e.key}`)
    }

    return(
        <Menu onClick={handleClick} selectedKeys={[current]} mode="horizontal">
            <Menu.Item key="album" icon={<CameraOutlined/>}>
                我的相册
            </Menu.Item>
            <Menu.Item key="userinfo" icon={<UserOutlined/>}>
                我的信息
            </Menu.Item>
        </Menu>
    )
}

export default withRouter(Sider);